﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="RegUserCtl.ascx.cs" Inherits="Admin_MemberAdmin_Controls_RegUserCtl" %>

<script type="text/javascript" language="javascript">
function checkLoginIdTextBox(source, arguments)
{
    arguments.IsValid=(arguments.Value.length >= 3 && arguments.Value.length < 15);
}

function checkPasswordLength(source,arguments)
{   
   arguments.IsValid=arguments.Value.length>= <%=Membership.MinRequiredPasswordLength %>;  
}

</script>

<fieldset>
    <legend>注册用户</legend>
    <p>
        <asp:Label ID="loginIdLabel" runat="server" Text="帐户:" AssociatedControlID="loginIdTextBox"></asp:Label>
        <asp:TextBox  ID="loginIdTextBox" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="LoginIdRequiredFieldValidator" runat="server" ErrorMessage="必须填写帐户信息"
            ControlToValidate="loginIdTextBox" Display="Dynamic"  CssClass="ui-state-highlight ui-corner-all"/>
        <asp:CustomValidator ControlToValidate="loginIdTextBox" ID="duplicateLoginidValidator"
            runat="server" ErrorMessage="帐户已经存在" Display="Dynamic" CssClass="error" OnServerValidate="ValidateDuplicateName" />
        <asp:CustomValidator ID="CustomValidator1" ControlToValidate="loginIdTextBox" runat="server"
            ClientValidationFunction="checkLoginIdTextBox" EnableClientScript="true" Display="Dynamic"
            ErrorMessage="帐户长度必须大于3位并且少于15" CssClass="error" />
        <asp:RegularExpressionValidator ID="LoginFormatValid" runat="server" ControlToValidate="loginIdTextBox"
            ErrorMessage="不能包含有空格括号等特殊字符" ValidationExpression="[^ \f\n\r\t\v\(\)\&\']*"
            Display="Dynamic" CssClass="error" />
    </p>
    <p>
        <asp:Label ID="PasswordLabel" runat="server" Text="密码:" AssociatedControlID="PasswordTextBox"></asp:Label>
        <asp:TextBox  ID="PasswordTextBox" runat="server" TextMode="Password"></asp:TextBox>
        <asp:RequiredFieldValidator ID="PasswordTextBoxRequiredFieldValidator" ControlToValidate="PasswordTextBox"
            runat="server" ErrorMessage="必须填写密码" Display="Dynamic"></asp:RequiredFieldValidator>
        <asp:CustomValidator ID="PasswordTextLengthValidator" runat="server" ControlToValidate="PasswordTextBox"
            ClientValidationFunction="checkPasswordLength" EnableClientScript="true" Display="Dynamic"
            ErrorMessage="密码长度必须大于5位" />
    </p>
    <p>
        <asp:Label ID="ConfirmPasswordLabel" runat="server" Text="确认密码" AssociatedControlID="ConfirmPasswordTextBox"></asp:Label>
        <asp:TextBox  ID="ConfirmPasswordTextBox" runat="server" TextMode="Password" />
        <asp:RequiredFieldValidator ID="ConfirmPasswordRequiredFieldValidator" runat="server"
            ErrorMessage="必须填写确认密码" ControlToValidate="ConfirmPasswordTextBox" Display="Dynamic" />
        <asp:CompareValidator ID="confirmPasswordCompareValidator" runat="server" ErrorMessage="确认密码和密码不相同"
            ControlToCompare="PasswordTextBox" ControlToValidate="ConfirmPasswordTextBox"
            Display="Dynamic" />
        <asp:CustomValidator ID="CustomValidator2" runat="server" ControlToValidate="EmailTextBox"
            Display="Dynamic" ErrorMessage="已经存在相同的Emial" OnServerValidate="ValidDuplicateEmail"></asp:CustomValidator>
    </p>
    <p>
        <asp:Label ID="EmailLabel" runat="server" Text="Email" AssociatedControlID="EmailTextBox"></asp:Label>
        <asp:TextBox  ID="EmailTextBox" runat="server"></asp:TextBox>
        <asp:RegularExpressionValidator ID="EmailRegularValidator" runat="server" ErrorMessage="请填写有效的Email格式,如:name@website.com"
            ControlToValidate="EmailTextBox" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
            Display="Dynamic"></asp:RegularExpressionValidator>
        <asp:RequiredFieldValidator ID="EmailRequiredValidator" runat="server" ErrorMessage="必须填写Email信息"
            ControlToValidate="EmailTextBox" Display="Dynamic"></asp:RequiredFieldValidator>
    </p>
    <p>
        <asp:Label ID="showNameLabel" Text="显示名称:" runat="server" AssociatedControlID="ShowNameTextBox"></asp:Label>
        <asp:TextBox  ID="ShowNameTextBox" runat="server"></asp:TextBox>
    </p>
    <p>
        <asp:Label ID="questionLabel" Text="问题:" runat="server" AssociatedControlID="questionLabel"></asp:Label>
        <asp:TextBox  ID="QuestionTextBox" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="QuestionRequiredFieldValidator" runat="server" ControlToValidate="QuestionTextBox"
            ErrorMessage="请填写问题" Display="Dynamic" />
    </p>
    <p>
        <asp:Label ID="answerLabel" runat="server" Text="答案:" AssociatedControlID="AnswerTextBox"></asp:Label>
        <asp:TextBox  ID="AnswerTextBox" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="AnswerRequiredFieldValidator" runat="server" ControlToValidate="answerTextBox"
            ErrorMessage="请填写答案" Display="Dynamic" />
    </p>
</fieldset>
